// src/components/AddTargetDirectoryForm.js
import React, { useState } from 'react';
import { TextField, Button, Box } from '@mui/material';

const AddTargetDirectoryForm = ({ onAdd }) => {
  const [dirName, setDirName] = useState('');

  const handleSubmit = (e) => {
    e.preventDefault();
    onAdd(dirName);
    setDirName('');
  };

  return (
    <Box component="form" onSubmit={handleSubmit} sx={{ display: 'flex', gap: 2, mb: 4 }}>
      <TextField
        label="输入新分类文件夹"
        variant="outlined"
        size="small"
        value={dirName}
        onChange={(e) => setDirName(e.target.value)}
      />
      <Button type="submit" size="small" variant="contained" color="primary">
        添加文件夹
      </Button>
    </Box>
  );
};

export default AddTargetDirectoryForm;